package drds.binlog.parse;

import drds.binlog.common.Authors;
import drds.binlog.database_driver.packets.IGtidSet;
import drds.common.Author;

import java.io.IOException;


@Author(name = Authors.LI_YANG)
public interface IConnection
{

    public void connect() throws IOException;

    public void reconnect() throws IOException;

    public void disconnect() throws IOException;

    /**
     * 用于快速数据查找,和dump的区别在于，seek会只给出部分的数据
     */
    public void seek(String binlogFileName, Long binlogPosition, SinkFunction sinkFunction) throws IOException;

    public void dump(String binlogFileName, Long binlogPosition, SinkFunction sinkFunction) throws IOException;

    public void dump(long timestamp, SinkFunction sinkFunction) throws IOException;

    /**
     * 通过GTID同步binlog
     */
    public void dump(IGtidSet gtidSet, SinkFunction sinkFunction) throws IOException;


    public void dump(String binlogFileName, Long binlogPosition, IMultiStageCoprocessor IMultiStageCoprocessor) throws IOException;

    public void dump(long timestamp, IMultiStageCoprocessor IMultiStageCoprocessor) throws IOException;

    public void dump(IGtidSet gtidSet, IMultiStageCoprocessor IMultiStageCoprocessor) throws IOException;

    IConnection fork();

    public long queryServerId() throws IOException;
}
